<!DOCTYPE html>
<html>
	<head>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta charset="UTF-8">
		<title>全唐通</title>
		<link rel="stylesheet" href="//cdn.bootcss.com/weui/0.4.3/style/weui.min.css">
		<link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/0.8.0/css/jquery-weui.min.css">
		<link rel="stylesheet" href="css/index.css" />
		<link rel="stylesheet" type="text/css" href="css/driverAllow.css" />
		<script src="//cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
		<script src="//cdn.bootcss.com/jquery-weui/0.8.2/js/jquery-weui.min.js"></script>
		<script type="text/javascript" src="lib/fastclick.js"></script>
	</head>
	<body ontouchstart="">
		<div class="wrap">
			<div class="weui_cell header">
				<div class="weui_cell_hd" id="userInfo">
					<img src="img/uesr.png"/>
				</div>
			    <div class="weui_cell_bd weui_cell_primary">
			    </div>
			</div>
			<div class="driverAllow-section">
				<div class="weui_cell driver-info">
					<div class="weui_cell_hd driver-tx">
						<img src="img/tx.png"/>
					</div>
					<div class="weui_cell_bd weui_cell_primary">
						<p>
							<span class="driver-name">刘先生</span>
							<span class="driver-evaluate">
								<img src="img/star_full.png">
								<img src="img/star_full.png">
								<img src="img/star_full.png">
								<img src="img/star_empty.png">
								<img src="img/star_empty.png">
							</span>
						</p>
						<p>
							<span class="driver-cartype">宇通T7</span>
							<span class="driver-carnum">冀A 21772</span>	
						</p>
					</div>
					<a class="weui_cell_ft driver-phone">
						<img src="img/tel.png"/>
					</a>
				</div>
				<div class="waiting-time">
					<p><span class="timeout-min">9</span>:<span class="timeout-sec">45</span></p>
					<p>叫车成功，请等待...</p>
				</div>
			</div>
			<div class="driverAllow-aside">
				<div class="distance-title">路程</div>
				<div class="weui_cell distance-info">
					<div class="weui_cell_hd">
						<img src="img/fn3.png"/>
					</div>
					<div class="weui_cell_bd">
						<p class="distance-start">唐山市-唐山植物园</p>						
					</div>
				</div>
				<div class="weui_cell distance-info">
					<div class="weui_cell_hd">
						<img src="img/fn3.png"/>
					</div>
					<div class="weui_cell_bd">
						<p class="distance-end">遵化市</p>						
					</div>
				</div>
			</div>
	  		<div class="weui_cell">
	  			<button class="weui_btn weui_btn_primary" style="background-color: #007AFF;" id="cancel">取消订单</button>
	  		</div>
  		</div>
  		<div class="modal-wall"></div>
  		<!--侧边栏-->
		<div class="weui_cells left-menu" id="left_menu">
			<div class="weui_cell usercenter">
				<div class="weui_cell_hd" >
					<img src="img/uesr.png"/>
				</div>
			    <div class="weui_cell_bd weui_cell_primary">
			    	<p class="user_number"></p>
			    </div>
			</div>
			<div class="weui_cell" id="orderlist">
				<div class="weui_cell_hd">
					<img src="img/banknote.png"/>
				</div>
			    <div class="weui_cell_bd weui_cell_primary">
			    	<p>行程</p>
			    </div>
			</div>
			<div class="weui_cell" id="bag">
				<div class="weui_cell_hd">
					<img src="img/banknote.png"/>
				</div>
			    <div class="weui_cell_bd weui_cell_primary">
			    	<p>钱包</p>
			    </div>
			</div>
			<div class="weui_cell" id="set">
				<div class="weui_cell_hd">
					<img src="img/banknote.png"/>
				</div>
			    <div class="weui_cell_bd weui_cell_primary">
			    	<p>设置</p>
			    </div>
			</div>
			<div class="weui_cell" id="download">
				<div class="weui_cell_hd">
					<img src="img/download.png"/>
				</div>
			    <div class="weui_cell_bd weui_cell_primary">
			    	<p >下载全唐通</p>
			    </div>
			</div>
		</div>
		<!-- 查询行程 -->
		<div id="order-list" class="weui-popup-container">
		  	<div class="weui-popup-overlay"></div>
		  	<div class="weui-popup-modal">
				<ul class="menu-list">

				</ul>
				<button class="close-popup">关闭</button>
		  	</div>
		</div>
		<script type="text/javascript" src="js/sideMenu.js"></script>
  		<script type="text/javascript" src="js/build.js"></script>
  		<script type="text/javascript">
  			$(function(){
  				(function(){
  					var driverInfo = JSON.parse(sessionStorage.DRIVER)
  					$(".driver-name").text(driverInfo.name + "先生")
  					$(".driver-cartype").text(driverInfo.carModel)
  					$(".driver-carnum").text(driverInfo.licensePlate)
  					$(".driver-phone").prop("href","tel:" + driverInfo.phoneNumber)
  					$(".distance-start").text(driverInfo.startLocation)
  					$(".distance-end").text(driverInfo.endLocation)
  				})()
  				Build.getMsg(false);
  				var min = $(".timeout-min").text();
				var sec = $(".timeout-sec").text();
				var timer = setInterval(function(){
					if (min != "00") {
						if(sec == "00"){
							sec = "59";
							min = parseInt(min) - 1;
							min = min < 10 ? "0" + min : min;
						}else{
							sec = parseInt(sec) - 1;
						}
						sec = sec < 10 ? "0" + sec : sec;
						$(".timeout-sec").text(sec);
						$(".timeout-min").text(min);
					}else{
						clearInterval(timer);
						$(".timeout-sec").text("00");
						$(".timeout-min").text("00");
					}
				},1000);
				// 司机接单后取消订单
				$("#cancel").on("click", function(){
					var driver = JSON.parse(sessionStorage.DRIVER);
					$.confirm("如果您取消订单可能会承担部分费用，您确定取消订单吗？",function(){
						$.ajax({
							type: "get",
							url: "http://qtt.tunnel.qydev.com/taxi/userCancelOrder",
							dataType: "jsonp",
							data: {
								oid: driver.oid
							},
							success: function (data) {
								if(data.code == "200"){
									Build.getMsg(true);
									$.alert("已取消订单", function(){
										window.location.href = "index.html";
									})
								}else{
									$.alert("操作失败");
									clearInterval(timer);
								}
							},
							error: function(xhr, text){
								console.log(text)
							}
						})
					})
				})
  			})
  		</script>
  	</body>
</html>